package com.archie.xunji.guanzhu.asyncs;

import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ListView;
import com.archie.xunji.guanzhu.adapters.PeopleAdapter;
import com.archie.xunji.guanzhu.entitys.People;
import com.archie.xunji.guanzhu.tools.HttpUtils;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

/**
 * Created by xqx on 2015/11/10.
 */
public class GetPeopleDetailsAsync extends AsyncTask<String,Void,String>{
    private ListView listView;
    private PeopleAdapter adapter;
    private Context context;
    private List<People> data;
    public GetPeopleDetailsAsync(Context context) {
        this.context = context;
    }

    @Override
    protected String doInBackground(String... params) {
        String url = null;
//userinfoid=26099&appuserid=43480&t=20151110121642&token=C668F1AB058CBDA5511A431D7B9F13F9C96E576D&source=6&sid=Co0gh2v0Nr&imei=9692B6993494E9324B7F9560912242B7&os=Android+4.4.4&key=WANDOUJIA&userid=70
//userinfoid=26099&appuserid=43480&t=20151110173249&token=206CAC4D62476D4955B1DAA9B38A3E503C0762F3&source=6&sid=mKXfSMO5wK&imei=9692B6993494E9324B7F9560912242B7&os=Android+4.4.4&key=WANDOUJIA&userid=70
//userinfoid=26099&appuserid=43480&t=20151110173226&token=40D7FC1138B7ACB2C516624EB7D430508E3EFC62&source=6&sid=mKXfSMO5wK&imei=9692B6993494E9324B7F9560912242B7&os=Android+4.4.4&key=WANDOUJIA&userid=272
        //20151110173249=--20151110121642
        if (params[0] != null) {
            HashMap<String,String> map = new HashMap<String, String>();
            map.put("userinfoid", "26099");
            map.put("appuserid","43480");
            map.put("t","20151110173249");
            map.put("token","206CAC4D62476D4955B1DAA9B38A3E503C0762F3");
            map.put("source","6");
            map.put("sid","Co0gh2v0Nr");
            map.put("imei","9692B6993494E9324B7F9560912242B7");
            map.put("os","Android+4.4.4");
            map.put("key","WANDOUJIA");
            map.put("userid","70");
            try {
                url = HttpUtils.sendByPost(params[0], map, "utf-8");
                Log.i("url-->","new-->"+url);
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
        return url;
    }

    @Override
    protected void onPostExecute(String s) {
//        if (s != null) {
//            data = People.getDataList(s);
//            adapter = new PeopleAdapter(data,context);
//            listView.setAdapter(adapter);
//
//        }
    }
}
